<?php
class stPostcardCategory_model extends stmodel_2_1{

    public function __construct($config) {
        parent::__construct ( $config );
        $this->setTableName($this->prefix.'st_postcard_category');
        $this->setPrimaryKey('id');
    }
    
    public function saveStPostcardCategory($data) {
        $data['id'] = isset($data['id'])? $data['id']:NULL;
        if($data['id'] == NULL){
            $time = isset($data['cdate'])? $data['cdate']:date('Y-m-d H:i:s');
            $data['cdate'] = $time;
        }
        
        return $this->saveRecords($data);
    }
    
    public function countRecords($args = ''){        
        $args['limit'] = array();
        $result = $this->getRecords($args);        
        return count($result);        
    }
    
}